When developing software applications, developers often write the code for an application to consume one or more pre-existing software components. For example, a software component may be been written previously, and that software component may have an interface contract that the software component will adhere to when the software component is invoked. For example, an interface contract may hint at input arguments, out arguments, and/or return values for one or more functions in the software component.
Many such interface contracts and software components are implemented as non-exception-based models, which typically return an error code (e.g. an HRESULT value). The error code can indicate whether the function succeeded or failed, and may also indicate other information, such as additional information about the nature of a failure if one occurs. Code can be written for the application to inspect the error code from such a component and to deal with failures if they occur. Other software components are implemented in exception-based models, which typically throw an exception if a failure occurs. For such exception-based models, exception handling functions can be invoked to handle the thrown exceptions and deal with corresponding failures. When consuming non-exception-based models, consuming applications typically invoke non-exception techniques, such as inspecting returned error codes to detect failures. Similarly, when consuming exception-based models, exception-based techniques such as exception handling functions are typically invoked.